AB#33053 fix AI cooldown wait state#2472
Merged
jacobwillsmith merged 1 commit intoMay 15, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Routes the "selected attachment summary" generation through the queued AI generation pipeline (instead of a direct sync API call), so the cooldown/rate-limit countdown reliably applies and shared generate buttons participate in the same wait state. Also reorders job completion so the rate-limit timestamp is stamped before the request is marked completed, preventing a window where the UI sees "Completed" without a cooldown.
Changes:
- New
QueueAttachmentSummaryRequestDto(withApplicationId+ optionalAttachmentIds) flows from JS → app service → queue → background job →AttachmentSummaryService, with validation at queue time and again in the service. - All four AI background jobs swap the order of
MarkCompletedInNewUowAsyncandStampRateLimitBestEffortAsyncso cooldown is stamped first. - ChefsAttachments.js now calls the queued endpoint and reuses
AIGenerationButtonState.monitor; the Generate button gets the sharedai-generate-btnclass so it joins the cooldown countdown. Two now-unused public methods are removed fromIAttachmentSummaryAppService.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Views/Shared/Components/ReviewList/ReviewList.js | Adds ai-generate-btn class to Generate workflow button so it shares cooldown styling. |
| Views/Shared/Components/ChefsAttachments/ChefsAttachments.js | Switches selected-attachment summary generation to the queued path with status monitoring. |
| GrantApplications/GrantApplicationAppService.cs | New DTO-based QueueAttachmentSummaryAsync, plus ResolveAttachmentSummaryIdsAsync validation. |
| GrantApplications/Automation/BackgroundJobs/RunApplicationAIPipelineJob.cs | Stamp rate-limit before marking completed (skipped & happy path). |
| GrantApplications/Automation/BackgroundJobs/GenerateAttachmentSummaryJob.cs | Pass AttachmentIds to service; swap completion/stamp order. |
| GrantApplications/Automation/BackgroundJobs/GenerateApplicationScoringJob.cs | Swap completion/stamp order. |
| GrantApplications/Automation/BackgroundJobs/GenerateApplicationAnalysisJob.cs | Swap completion/stamp order. |
| GrantApplications/Automation/ApplicationAIGenerationQueue.cs | Forward attachmentIds into the background job args. |
| Application.Contracts/GrantApplications/QueueAttachmentSummaryRequestDto.cs | New input DTO. |
| Application.Contracts/GrantApplications/IGrantApplicationAppService.cs | Updated interface signature. |
| Application.Contracts/.../GenerateAttachmentSummaryBackgroundJobArgs.cs | Adds AttachmentIds to job args. |
| Unity.AI.Application/Attachments/AttachmentSummaryAppService.cs | Removes the two direct sync generate endpoints (now routed via queue). |
| Unity.AI.Application/AI/Operations/IAttachmentSummaryService.cs | Adds optional attachmentIds parameter. |
| Unity.AI.Application/AI/Operations/AttachmentSummaryService.cs | Implements selected-attachment filtering with membership validation. |
| Unity.AI.Application.Contracts/Automation/IApplicationAIGenerationQueue.cs | Adds attachmentIds to queue contract. |
| Unity.AI.Application.Contracts/Attachments/IAttachmentSummaryAppService.cs | Removes obsolete public methods. |
a189cbe to
9080c29
Compare
|
hasanpour
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Fixes inconsistent AI cooldown wait-state behavior across generate flows.
Changes